package com.hsoft.zhxy.app.demo_03_01.controller;

import com.alibaba.fastjson.JSONObject;
import com.hsoft.zhxy.common.result.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Api(tags = "demo_03_01 获取配置文件中参数")
@Log4j2
@Validated
@RestController
@RequestMapping(value = "/demo_03_01/demoProperties/", produces = "application/json;charset=UTF-8")
public class Demo005PropertiesController {

    @Value("${demo.param}")
    private String param;

    /**
     * 获取配置文件中参数
     * @return JSONObject
     */
    @ApiOperation(value = "获取配置文件中参数", notes = "获取配置文件中参数")
    @GetMapping("getParamFromConfig")
    public JSONObject getParamFromConfig() {
        return ResultBody.setData(this.param);
    }

}
